package com.kk.demo.java8.threadstream;

import java.util.Random;
import java.util.concurrent.LinkedBlockingQueue;

public class Sender implements Runnable {

    private LinkedBlockingQueue<String> value;

    public Sender(LinkedBlockingQueue<String> value) {
        this.value = value;
    }

    @Override
    public void run() {

        Random rand = new Random();

        while (true) {
            String valuestr = rand.nextInt() + "," + rand.nextInt();

            value.offer(valuestr);

            try {
                Thread.currentThread().sleep(1000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

    }

}
